<!--<div id="tupujulei_div_content_tupu" style="width: 80%;height: 300px;display: none;"></div>-->
<div id="tupujulei_div_content_tupu2" style="width: 100%;height:600px;border: none;overflow: scroll;"></div>




<script type="text/javascript">
    var findnlptupudatalink = webrootpath+"nlpner/findnlptupudatalink";  //获取图谱聚类数据
    var findnlptupudatayezilink = webrootpath+"nlpner/findnlptupudatayezilink";  //获取叶子节点数据
    var alldatalist = "";
    var alldatalistlink = "";


    $(function () {
        findnlptupudatalink_fun();

    });
    function findnlptupudatalink_fun() {
        var myChart = echarts.init(document.getElementById('tupujulei_div_content_tupu2'));


        var treeObj = $.fn.zTree.getZTreeObj("index_lm_tree");
        var nodes = treeObj.getSelectedNodes();
        var selectcateid = nodes[0].cateid;
        $.post(findnlptupudatalink,{
            selectcateid:selectcateid
        },function (_info) {
            console.log(_info);
            if(_info.code=="1"){
                alldatalist = _info.alldatalist;
                alldatalistlink = _info.alldatalistlink;

                var categories = _info.taglist;
                var option = {
                    // 图的标题
                    title: {
                        text: ''
                    },
                    // 提示框的配置
                    tooltip: {
                        formatter: function (x) {
                            return x.data.des;
                        }
                    },
                    // 工具箱
                    toolbox: {
                        // 显示工具箱
                        show: true,
                        feature: {
                            mark: {
                                show: true
                            },
                            // 还原
                            restore: {
                                show: true
                            },
                            // 保存为图片
                            saveAsImage: {
                                show: true
                            }
                        }
                    },
                    animation:false,
                    series: [{
                        type: 'graph', // 类型:关系图
                        layout: 'force', //图的布局，类型为力导图
                        symbolSize: 40, // 调整节点的大小
                        roam: true, // 是否开启鼠标缩放和平移漫游。默认不开启。如果只想要开启缩放或者平移,可以设置成 'scale' 或者 'move'。设置成 true 为都开启
                        edgeSymbol: ['circle', 'arrow'],
                        edgeSymbolSize: [2, 10],
                        edgeLabel: {
                            normal: {
                                textStyle: {
                                    fontSize: 20
                                }
                            }
                        },
                        force: {
                            repulsion: 500,
                            edgeLength: [10, 30],
                            layoutAnimation:false
                        },
                        draggable: true,
                        lineStyle: {
                            normal: {
                                width: 2,
                                color: '#4b565b',
                            }
                        },
                        edgeLabel: {
                            normal: {
                                show: true,
                                formatter: function (x) {
                                    return x.data.name;
                                }
                            }
                        },
                        label: {
                            normal: {
                                show: true,
                                textStyle: {}
                            }
                        },
                        data:alldatalist,
                        links:alldatalistlink,
                        categories:categories
                    }]
                };
                myChart.setOption(option);


                myChart.on('click', function (params) {
                    if(parseInt(params.dataIndex)>0){
                        //叶子节点
                        $.post(findnlptupudatayezilink,{
                            tupuname:params.name,
                            selectcateid:selectcateid
                        },function (_info_2) {
                            var alldatalist_2 = alldatalist.concat(_info_2.alldatalist);
                            var alldatalistlink_2 = alldatalistlink.concat(_info_2.alldatalistlink);



                            if(_info_2.code=="1"){
                                myChart.setOption({
                                    series: [
                                        {
                                            roam: true,
                                            data: alldatalist_2,
                                            edges: alldatalistlink_2
                                        }
                                    ]
                                });
                            }
                        },"json");
                    }
                });
            }
        },"json");
    }
/*

    var myChart = echarts.init(document.getElementById('tupujulei_div_content_tupu'));
    var categories = [{name:"蜀"},{name:"魏"},{name:"吴"}];

    var option = {
        // 图的标题
        title: {
            text: '三国人物关系图'
        },
        // 提示框的配置
        tooltip: {
            formatter: function (x) {
                return x.data.des;
            }
        },
        // 工具箱
        toolbox: {
            // 显示工具箱
            show: true,
            feature: {
                mark: {
                    show: true
                },
                // 还原
                restore: {
                    show: true
                },
                // 保存为图片
                saveAsImage: {
                    show: true
                }
            }
        },
        legend: [{
            // selectedMode: 'single',
            //设置可以根据类别显示or隐藏节点
            data: categories.map(function (a) {
                return a.name;
            })
        }],
        series: [{
            type: 'graph', // 类型:关系图
            layout: 'force', //图的布局，类型为力导图
            symbolSize: 40, // 调整节点的大小
            roam: true, // 是否开启鼠标缩放和平移漫游。默认不开启。如果只想要开启缩放或者平移,可以设置成 'scale' 或者 'move'。设置成 true 为都开启
            edgeSymbol: ['circle', 'arrow'],
            edgeSymbolSize: [2, 10],
            edgeLabel: {
                normal: {
                    textStyle: {
                        fontSize: 20
                    }
                }
            },
            force: {
                repulsion: 2500,
                edgeLength: [10, 50]
            },
            draggable: true,
            lineStyle: {
                normal: {
                    width: 2,
                    color: '#4b565b',
                }
            },
            edgeLabel: {
                normal: {
                    show: true,
                    formatter: function (x) {
                        return x.data.name;
                    }
                }
            },
            label: {
                normal: {
                    show: true,
                    textStyle: {}
                }
            },
            data: [
                {
                    name: '刘备',
                    des: '刘备',
                    symbolSize: 70,//节点大小
                    category: 0,//设置节点所属类别
                },
                {
                    name:"关羽",
                    des:"关羽",
                    symbolSize:60,
                    category:0,
                },
                {
                    name:"曹操",
                    des:"曹操",
                    symbolSize:70,
                    category:1,
                },
                {
                    name:"曹真",
                    des:"曹真",
                    symbolSize:60,
                    category:1,
                }
            ],
            links: [{
                source: '关羽',//源节点
                target: '刘备',//目标节点
                name: '义弟',//关系
                des: ''
            },{
                source: '曹真',//源节点
                target: '曹操',//目标节点
                name: '父子',//关系
                des: ''
            },{
                source: '关羽',//源节点
                target: '曹操',//目标节点
                name: '恩人',//关系
                des: ''
            }],
            categories: [{name:"蜀"},{name:"魏"},{name:"吴"}]


        }]
    };
    myChart.setOption(option);*/


</script>